_Pragma("once")

#include <string>

#include "libmath.hpp"

namespace sdl_engine::component::ecs {

// regist your component here
enum ComponentType {
    COMP_INVALID = -1,
    COMP_MOVE = 0,

    COMP_NUM
};

#define DECLARE_COMPONENT_TYPE(t) \
    static ComponentType Type() { return t; } \
    ComponentType GetType() const override { return Type(); }

class Component {
public:
    Component(ComponentType type);
    virtual ~Component() = default;

    virtual ComponentType GetType() const =0;

private:
    ComponentType type_;
};

class MoveComponent: public Component {
public:
    DECLARE_COMPONENT_TYPE(COMP_MOVE)

    MoveComponent();

    inline const Point& GetPoint() const { return position_; }
    void Move(const Point& offset) { position_ += offset; }
    void MoveTo(const Point& pos) { position_ = pos; }

private:
    Point position_;
};


}
